<?php
/**
 * +----------------------------------------------------------------------
 * | Author: 罗极
 * +----------------------------------------------------------------------
 * | Description: RequestRouter.php
 * +----------------------------------------------------------------------
 * | User: Administrator Date: 8/21/ 0021 Time: 13:03
 * +----------------------------------------------------------------------
 */

namespace Framework\Router\Abstracts;
use Framework\Router\Constant\DefaultKey;

abstract class RequestRouter
{
    protected $module;
    protected $controller;
    protected $action;



    public function __construct(string $module, string $controller, string $action)
    {
        $this->module       = ucfirst($module);
        $this->controller   = ucfirst($controller);
        $this->action       = lcfirst($action);
    }

    /**
     * @return string
     */
    public function getModule() {
        return ucfirst($this->module);
    }


    /**
     * @return mixed
     */
    public function getController() {
        return ucfirst($this->controller);
    }

    /**
     * @param mixed $controller
     */
    public function setController($controller) {
        $this->controller = ucfirst($controller);
    }

    /**
     * @return mixed
     */
    public function getAction() {
        return lcfirst($this->action);
    }

    /**
     * @param mixed $action
     */
    public function setAction($action)
    {
        $this->action = lcfirst($action);
    }


    public function getModuleWithSuffix() : string
    {
        return $this->module.DefaultKey::ModuleSuffix;
    }


    public function getControllerWithSuffix() : string
    {
        return $this->controller.DefaultKey::ControllerSuffix;
    }

    public function getActionWithSuffix() : string
    {
        return lcfirst($this->action).DefaultKey::ActionSuffix;
    }
}